class CreateImpressions < ActiveRecord::Migration
  def self.up
    create_table :impressions, :force => true do |t|
      t.string :request_id
      t.string :impressionable_type
      t.integer :impressionable_id
      t.string :controller_name
      t.string :action_name
      t.integer :object_id
      t.string :formats
      t.string :method
      t.string :path
      t.integer :status
      t.float :db_duration
      t.float :view_duration
      t.float :page_duration
      t.string :session_hash
      t.string :referrer
      t.string :ip_address
      t.integer :user_id
      t.timestamps
    end
    
    add_index :impressions, [:impressionable_id, :impressionable_type]
    add_index :impressions, :object_id
    add_index :impressions, :request_id
    add_index :impressions, :user_id
  end

  def self.down
    drop_table :impressions
  end
end